package com.sky.controller.user;

import com.sky.constant.StatusConstant;
import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: 夏帮连
 * @date: 2025/06/24
 * @description:
 * @version: 1.0
 */
@RestController("userCategoryController")
@Slf4j
@RequestMapping("/user/category")
@Api("小程序分类")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("/list")
    @ApiOperation("查询分类")
    public Result<List<Category>> list(Integer type) {
        log.info("小程序分类查询:{}", type);
        Category category = Category.builder().type(type).status(StatusConstant.ENABLE).build();
        List<Category> list=categoryService.list(category);
        return Result.success(list);
    }
}
